<?php
namespace App\Model;

use PhalApi\Model\NotORMModel as NotORM;

class APP extends NotORM
{

    protected function getTableName($id)
    {
        return 'app';
    }

    public function getApps($app)
    {
        $appList = $this->getORM()->where('id', $app)->select('id','app_name','app_logo','wallet','en_name','app_pic','types','number')->fetchOne();
        $appList = $this->appDetail($appList);
        return $appList;
    }

    public function appDetail($appList)
    {
        $downurl=\PhalApi\DI()->notorm->version->where('app_id',$appList['id'])->order('id desc')->fetchOne();
        $appList['andr_baoname']=$downurl['andr_baoname']??'';
        $appList['andr_apk']   =$downurl['andr_apk']??'';
        $appList['andr_banben']=$downurl['andr_banben']??'';
        $appList['andr_size']  =$downurl['andr_size']??'';
        $appList['andr_url']   =$downurl['andr_url']??'';
        $appList['ios_url']    =$downurl['ios_url']??'';
        $appList['ios_size']   =$downurl['ios_size']??'';
        $appList['ios_banben'] =$downurl['ios_banben']??'';
        $appList['ios_plist']  =$downurl['ios_plist']??'';
        $appList['ios_bundle_id']=$downurl['ios_bundle_id']??'';
        $appList['ios_schemes']=$downurl['ios_schemes']??'';
        return $appList;
    }
}